import os

import pandas as pd


def get_list(file_path=None):
    """
    获取各ATM的信息
    :param file_path: 文件path
    :return: 编号列表，型号列表，位置列表
    """
    if file_path is None:
        file_path = os.path.join(os.path.dirname(os.path.abspath(os.path.dirname(__file__))), 'DATA',
                                 'device_info_1.csv')
    try:
        data = pd.read_csv(file_path, encoding='utf-8')
    except:
        data = pd.read_csv(file_path, encoding='gbk')
    output = {}
    for idx, row in data.iteritems():
        output[idx] = list(row)
    return output


if __name__ == '__main__':
    output = get_list(os.path.join(os.path.dirname(os.path.abspath(os.path.dirname(__file__))), 'atm_opt', 'DATA',
                                   'device_info_1.csv'))
    print(output)
